<script src="/include/calendar/calendar.js"></script>
<style type="text/css">
a {
	cursor: pointer;
}
#search-form input,#search-form select {
	width: 128px;
}
</style>
<div class="pageheader">
	<h2>
		<i class="fa fa-pencil-square"></i>日志管理
	</h2>
	<div class="breadcrumb-wrapper">
		<span class="label">你所在的位置：</span>
		<ol class="breadcrumb">
			<li><a href="/index">ERP管理系统</a></li>
			<li>日志管理</li>
			<li class="active">做出货单</li>
		</ol>
	</div>
</div>
<div class="contentpanel">
<div class="main">
    <form id="search-form" class="form-inline" method="get" action="/log/makelist" style="margin-bottom: 10px;">
        <div class="form-group">
            <label for="Orderid">订单号</label>
            <input type="text" name="orderid" value="<?php echo $this->orderid;?>" class="form-control">
        </div>
        <div class="form-group">
            <label for="Site">网站</label>
            <select class='form-control' name='site'>
                <option value=''>选择网站</option>
                <option value='gogoalshop.com'>gogoalshop.com</option>
		        <option value='jerseysmark.com'>jerseysmark.com</option>
		        <option value='goaljerseys.com'>goaljerseys.com</option>
		        <option value='fancybestdeal.com'>fancybestdeal.com</option>
	    	    <option value='elmontyouthsoccer.com'>elmontyouthsoccer.com</option>
		        <option value='bestcheapsoccer.com'>bestcheapsoccer.com</option>
		        <option value='minejerseys.com'>minejerseys.com</option>
	    	</select>
        </div>
        <div class="form-group">
            <label for="Site">状态</label>
            <select class='form-control' name='statu'>
                <option value='' <?php if($this->statu == ''){echo 'selected="selected"';}?>>选择</option>
                <option value='0' <?php if($this->statu == '0'){echo 'selected="selected"';}?>>未做单</option>
		        <option value='1' <?php if($this->statu == '1'){echo 'selected="selected"';}?>>已做单</option>
	    	</select>
        </div>
        <div class="form-group">
            <label for="date">日期:</label>
            <input class="form-control" type="text" name="starttime" onclick="new Calendar().show(this);" readonly="readonly" value="<?php echo $this->starttime;?>">
	               至<input class="form-control" type="text" name="endtime" onclick="new Calendar().show(this);" readonly="readonly" value="<?php echo $this->endtime;?>">
        </div>
        <button type="submit" class="btn btn-primary">搜索</button>
    </form>
    <form id="printlist" target="_blank" method="post" action="/log/printlist">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th><input type="checkbox" name="checkall">&nbsp;&nbsp;全选</th>
                    <th>订单号</th>
                    <th>网站</th>
                    <th>订单金额</th>
                    <th>快递方式</th>
                    <th>运费</th>
                    <th>状态</th>
                    <th>下单时间</th>
                </tr>
            </thead>
            <tbody>      
                <?php 
                if ($this->logList){
                	$i=0;
                	$class = 'info';
                    foreach ($this->logList as $v){
                    	if($i>0){
                    		if($v['order_id'] == $this->logList[$i-1]['order_id']){
                    			//$class='info';
                    		}else{
                    			$class = $class=='warning'?'info':'warning';
                    		}
                    	}
                    	$i+=1;
                    	if($v['flag'] == 'sub'){
                ?>
                <tr class="<?php echo $class;?>">
				    <td><input type="checkbox" name="isprint[]" value="<?php echo $v['id'];?>">操作</td>
				    <td><?php echo $v['order_id']; ?></td>
                    <td><?php echo $v['site'];?></td>
                    <td><?php echo $v['total_amount'];?></td>
				    <td><?php echo $v['ship_company'];?></td>
				    <td><?php echo $v['yunfei'];?></td>
				    <td>
				        <?php
				        	switch ($v['statu'])
				        	{
				        		case 1:
				        			echo '<span class="label label-primary">已做单</span>';
				        		    break;
				            	default:
				            		echo '<span class="label label-warning">未做单</span>';
				        	}
				        ?>
				    </td>
				    <td><?php echo $v['add_time']; ?></td>
			    </tr> 
			    <?php 
                    	}
                    } 
                }
                ?>
			    <tr>
			        <td colspan="8">
			        <?php
					     echo $this->paginationControl ( $this->paginator, 'Sliding', 'page/pager.phtml', array (
					     	'orderid'=>$this->orderid,
					     	'site'=>$this->site,
					     	'statu'=>$this->statu,
						    'starttime' => $this->starttime,
						    'endtime' => $this->endtime 
				    	) );
				    ?>
			        </td>
			    </tr>
		    </tbody>
        </table>
    </div>
    <input class="btn btn-primary" type="submit" value="打印成出货单">
    </form>
</div>
</div>
